﻿using System.Windows;
using System.Windows.Controls;
using AutoMapper;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;
using YJTTool.CustomerInfo;
using YJTTool.CustomerInfo.Views;
using YJTTool.DBBaseServer.Entities;
using YJTTool.DrugControls;
using YJTTool.DrugControls.Views;
using YJTTool.MainWindow;
using YJTTool.MainWindow.Model;
using YJTTool.MainWindow.Profiles;
using YJTTool.MainWindow.ViewModels;
using YJTTool.MainWindow.Views;
using YJTTools.Views;

namespace YJTTools
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainWindow>();
        }
        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.RegisterSingleton<IRegionManager, RegionManager>();
            // AutoMapper 注册
            containerRegistry.RegisterSingleton<IMapper>(provider =>
            {
                var config = new MapperConfiguration(cfg =>
                {
                    cfg.AddProfile<MappingProfile>();
                });
                config.AssertConfigurationIsValid();
                return config.CreateMapper();
            });
        }
        protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
        {
            moduleCatalog.AddModule<MainWindowModule>();
            moduleCatalog.AddModule<DrugControlsModule>();
            moduleCatalog.AddModule<CustomerInfoModule>();
        }
    }
}
